import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2022-03-29
 * Time: 10:44
 */
    public class TestDemp3 {
    public static void main10(String[] args) {
        String s=null;

        System.out.println("s="+s);
    }

    public static void main9(String[] args) {
        int[] arr={1,1,2,3,2,3,4,5,5};
        int a=find(arr);
        System.out.println(a);
    }
    public static int find(int[] arr) {
        int sum=0;
        for (int x:arr) {
                sum^=x;
        }
        return sum;
    }
    public static void main8(String[] args) {
        int[] array={1,2,8,4,5,6};
        my_sort(array);
        System.out.println(Arrays.toString(array));
    }
    public static void my_sort(int[] array) {
        for (int i = 0; i < array.length-1; i++) {
            int flg=0;
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j]>array[j+1]) {
                    int tmp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=tmp;
                    flg=1;
                }

            }
            if(flg==0)
                return ;
        }
    }
    public static void main7(String[] args) {
        int[] array={1,2,8,4,5,6};
        int a=judge(array);
        if(a==1)
            System.out.println("yes");
        else
            System.out.println("no");
    }
    public static int judge(int[] array) {
        for (int i = 0; i < array.length-1; i++) {
            for (int j = i+1; j <array.length ; j++) {
                if(array[i]>array[j]) {
                    return -1;
                }
            }
        }
        return 1;
    }
    public static void main6(String[] args) {
            int[] array={1,2,3,4,5,6,7,8,9};
            int a=my_binary(array,7);
            if(a==-1)
                System.out.println("查无");
            else
                System.out.println("下标为"+a);
    }
    public static int my_binary(int[] array,int e)  {
        int left=0;
        int right=array.length-1;
        while(left<=right) {
            int mid=(left+right)/2;
            if(array[mid]==e) {
                return mid;
            }
            else if(array[mid]>e) {
                right=mid-1;
            }
            else if(array[mid]<e){
                left=mid+1;

            }
        }
        return -1;
    }
    public static void main5(String[] args) {
        int[] array={1,2,3,4,5};
       String str=myToString(array);
        System.out.println(str);
    }
    public static String myToString(int[] array) {
        String str="[";
        for (int i = 0; i < array.length; i++) {
            str=str+array[i];
            if(i!=array.length-1) {
                str+=',';
            }
        }
        str+=']';
        return str;
    }
    public static void main4(String[] args) {
        int[] arr1={1,2,3};
        int[] arr2=my_cofeOf(arr1);
        System.out.println(Arrays.toString(arr2));
    }
    public static int[] my_cofeOf(int[] arr) {
        int[] arr2=new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            arr2[i]=arr[i];
        }
        return arr2;
    }
    public static void main3(String[] args) {
        int[] array=new int[100];
        for (int i = 0; i < array.length; i++) {
            array[i]=i+1;
        }
        System.out.println(Arrays.toString(array));
    }
    public static void main2(String[] args) {
        int[] array={1,2,3};
        printArray(array);
    }
    public static void printArray(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
    }
    public static void main1(String[] args) {
        int[] array={1,2,3};
        transform(array);
        System.out.println( Arrays.toString(array));
    }
    public static void transform(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i]=array[i]*2;
        }
    }
}
